﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>泸县康复医院差旅费报销计算查询工具(手机版)</title>
    <style>
        /* 重置与基础样式 */
        * {
            box-sizing: border-box;
            font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
            -webkit-tap-highlight-color: transparent;
        }
        
        body {
            margin: 0;
            padding: 0;
            background-color: #f5f7fa;
            color: #333;
            font-size: 15px;
            line-height: 1.5;
            overflow-x: hidden;
        }
        
        /* 容器 */
        .container {
            width: 100%;
            max-width: 100%;
            margin: 0 auto;
            background-color: white;
            min-height: 100vh;
        }
        
        /* 头部 */
        header {
            background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
            color: white;
            padding: 20px 15px;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        h1 {
            margin: 0 0 5px 0;
            font-size: 20px;
            font-weight: 600;
            line-height: 1.3;
        }
        
        .subtitle {
            font-size: 12px;
            opacity: 0.9;
            margin-top: 5px;
            line-height: 1.4;
        }
        
        /* 选项卡导航 - 移动端优化 */
        .tab-container {
            display: flex;
            background-color: white;
            border-bottom: 1px solid #e0e0e0;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            white-space: nowrap;
            padding: 0 10px;
            scrollbar-width: none; /* Firefox */
        }
        
        .tab-container::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        .tab {
            padding: 15px 12px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: all 0.2s;
            flex-shrink: 0;
        }
        
        .tab.active {
            color: #3498db;
            border-bottom-color: #3498db;
            font-weight: 600;
        }
        
        /* 选项卡内容 */
        .tab-content {
            display: none;
            padding: 15px;
        }
        
        .tab-content.active {
            display: block;
        }
        
        /* 表单部分 */
        .section {
            margin-bottom: 20px;
            border-radius: 10px;
            padding: 18px;
            background-color: white;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            border: 1px solid #f0f0f0;
        }
        
        h2 {
            color: #2c3e50;
            font-size: 18px;
            margin: 0 0 15px 0;
            padding-bottom: 10px;
            border-bottom: 2px solid #3498db;
            font-weight: 600;
        }
        
        h3 {
            color: #34495e;
            font-size: 16px;
            margin: 20px 0 12px 0;
            font-weight: 600;
        }
        
        /* 表单元素 */
        .form-group {
            margin-bottom: 18px;
        }
        
        label {
            display: block;
            margin-bottom: 6px;
            font-weight: 600;
            font-size: 14px;
            color: #444;
        }
        
        select, input, textarea {
            width: 100%;
            padding: 14px 12px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            background-color: white;
            -webkit-appearance: none;
            appearance: none;
            transition: border-color 0.2s;
        }
        
        select:focus, input:focus, textarea:focus {
            outline: none;
            border-color: #3498db;
            box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
        }
        
        /* 单选和复选框组 */
        .radio-group, .checkbox-group {
            background-color: white;
            padding: 12px;
            border-radius: 8px;
            border: 1px solid #eee;
        }
        
        .radio-option, .checkbox-option {
            display: flex;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid #f5f5f5;
        }
        
        .radio-option:last-child, .checkbox-option:last-child {
            border-bottom: none;
        }
        
        .radio-option input, .checkbox-option input {
            width: 22px;
            height: 22px;
            margin-right: 12px;
            flex-shrink: 0;
        }
        
        .radio-option label, .checkbox-option label {
            margin-bottom: 0;
            font-weight: normal;
            cursor: pointer;
            flex: 1;
        }
        
        /* 按钮 */
        button {
            background-color: #3498db;
            color: white;
            border: none;
            padding: 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            transition: background-color 0.2s;
            width: 100%;
            margin-bottom: 10px;
            touch-action: manipulation;
        }
        
        button:hover, button:active {
            background-color: #2980b9;
        }
        
        .button-group {
            margin-top: 25px;
        }
        
        .button-group button {
            margin-bottom: 12px;
        }
        
        /* 结果框 */
        .result-box {
            background-color: #e8f4fc;
            border: 2px solid #3498db;
            border-radius: 10px;
            padding: 20px;
            margin-top: 20px;
        }
        
        .result-item {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px dashed #b8d9f0;
        }
        
        .result-item.total {
            font-weight: bold;
            font-size: 18px;
            border-top: 2px solid #3498db;
            margin-top: 10px;
            padding-top: 15px;
            border-bottom: none;
        }
        
        /* 表格 */
        .standard-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
            font-size: 13px;
            overflow-x: auto;
            display: block;
        }
        
        .standard-table th, .standard-table td {
            border: 1px solid #ddd;
            padding: 10px 6px;
            text-align: center;
        }
        
        .standard-table th {
            background-color: #2c3e50;
            color: white;
            font-weight: 600;
            white-space: nowrap;
        }
        
        .standard-table tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        
        /* 文档容器 */
        .document-container {
            background-color: white;
            padding: 20px;
            line-height: 1.6;
        }
        
        .document-title {
            text-align: center;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 20px;
            color: #2c3e50;
        }
        
        .document-content {
            font-size: 15px;
            margin-bottom: 25px;
        }
        
        /* 签名区域 */
        .signature-area {
            margin-top: 40px;
            text-align: right;
        }
        
        .signature-line {
            display: inline-block;
            width: 150px;
            border-bottom: 1px solid #333;
            margin-left: 10px;
            padding-bottom: 3px;
            text-align: center;
        }
        
        .signature-label {
            display: inline-block;
        }
        
        /* 自定义复选框 */
        .compact-list {
            margin: 0;
            padding: 0;
        }
        
        .compact-item {
            margin-bottom: 12px;
            display: flex;
            align-items: flex-start;
        }
        
        .checkbox-symbol {
            display: inline-block;
            width: 22px;
            height: 22px;
            border: 2px solid #3498db;
            margin-right: 12px;
            margin-top: 2px;
            flex-shrink: 0;
            border-radius: 4px;
            background-color: white;
        }
        
        .checkbox-symbol.checked {
            background-color: #3498db;
            position: relative;
        }
        
        .checkbox-symbol.checked:after {
            content: "✓";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 14px;
            color: white;
            font-weight: bold;
        }
        
        /* 警告和提示 */
        .note {
            background-color: #fffde7;
            padding: 15px;
            border-left: 4px solid #f39c12;
            margin-top: 20px;
            font-size: 13px;
            border-radius: 0 8px 8px 0;
        }
        
        .note h4 {
            margin-top: 0;
            color: #e67e22;
            font-size: 14px;
        }
        
        .warning {
            background-color: #ffeaa7;
            padding: 12px;
            border-left: 4px solid #f39c12;
            margin-top: 10px;
            font-size: 13px;
            border-radius: 0 8px 8px 0;
        }
        
        /* 内联输入框 */
        .form-input-inline {
            display: inline-block;
            border: none;
            border-bottom: 1px solid #ccc;
            background: transparent;
            padding: 0 5px;
            min-width: 60px;
            text-align: center;
            font-size: inherit;
            outline: none;
            height: 24px;
        }
        
        /* 日期时间组 */
        .date-time-group {
            display: flex;
            gap: 10px;
        }
        
        .date-input {
            flex: 2;
        }
        
        .time-select {
            flex: 1;
        }
        
        /* 隐藏打印容器 */
        .print-container {
            display: none;
        }
        
        /* 响应式调整 */
        @media (max-width: 480px) {
            .tab {
                padding: 15px 10px;
                font-size: 13px;
            }
            
            h1 {
                font-size: 18px;
            }
            
            .section {
                padding: 15px;
            }
            
            select, input, textarea {
                padding: 12px 10px;
                font-size: 15px;
            }
            
            .standard-table th, .standard-table td {
                padding: 8px 4px;
                font-size: 12px;
            }
            
            .form-input-inline {
                min-width: 50px;
            }
        }
        
        @media (min-width: 768px) {
            .container {
                max-width: 600px;
                margin: 20px auto;
                border-radius: 15px;
                overflow: hidden;
                box-shadow: 0 5px 25px rgba(0,0,0,0.1);
            }
            
            body {
                padding: 10px;
            }
        }
        
        /* 滚动条美化 */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        
        ::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }
        
        ::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 10px;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .tab-content.active {
            animation: fadeIn 0.3s ease-out;
        }
        
        /* 底部安全区域 */
        .safe-area-bottom {
            padding-bottom: env(safe-area-inset-bottom);
        }
        
        /* 移动端优化的输入框 */
        input[type="date"] {
            min-height: 48px;
        }
        
        /* 触摸友好的按钮 */
        .touch-button {
            position: relative;
            overflow: hidden;
        }
        
        .touch-button:after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 5px;
            height: 5px;
            background: rgba(255, 255, 255, 0.5);
            opacity: 0;
            border-radius: 100%;
            transform: scale(1, 1) translate(-50%);
            transform-origin: 50% 50%;
        }
        
        .touch-button:focus:not(:active)::after {
            animation: ripple 1s ease-out;
        }
        
        @keyframes ripple {
            0% {
                transform: scale(0, 0);
                opacity: 0.5;
            }
            100% {
                transform: scale(40, 40);
                opacity: 0;
            }
        }
    </style>
</head>
<body>
    <div class="container safe-area-bottom">
        <header>
            <h1>泸县康复医院差旅费报销计算查询工具</h1>
            <div class="subtitle">根据泸县康复医院差旅费管理办法及相关规定制定<br>(住宿费标准依据：泸县财行〔2016〕5号)</div>
        </header>
        
        <div class="tab-container">
            <div class="tab active" data-tab="calculator">费用计算</div>
            <div class="tab" data-tab="standards">报销标准</div>
            <div class="tab" data-tab="accommodation">住宿标准</div>
            <div class="tab" data-tab="card-explain">公务卡说明</div>
            <div class="tab" data-tab="integrity-commitment">廉洁承诺</div>
            <div class="tab" data-tab="reference">政策依据</div>
        </div>
        
        <!-- 费用计算器选项卡 -->
        <div id="calculator" class="tab-content active">
            <div class="section">
                <h2>出差基本信息</h2>
                
                <div class="form-group">
                    <label for="personnel-level-mobile">人员级别</label>
                    <select id="personnel-level-mobile">
                        <option value="other">其他人员（科级及以下）</option>
                        <option value="county">县处级</option>
                        <option value="department">厅局级</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <label for="travel-type-mobile">出差类型</label>
                    <select id="travel-type-mobile">
                        <option value="normal">普通公务出差</option>
                        <option value="conference">参加会议</option>
                        <option value="training">参加培训</option>
                        <option value="internship">外出进修</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <label for="departure-location-mobile">出发地</label>
                    <input type="text" id="departure-location-mobile" placeholder="例如：泸县康复医院" value="泸县康复医院">
                </div>
                
                <div class="form-group">
                    <label for="destination-province-mobile">出差目的地</label>
                    <select id="destination-province-mobile">
                        <option value="sichuan">四川省内</option>
                        <option value="luxian-county">泸县县内</option>
                        <option value="other-province">其他省份</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <label for="destination-city-mobile">具体城市/乡镇</label>
                    <select id="destination-city-mobile">
                        <option value="chengdu">成都市</option>
                        <option value="luzhou">泸州市（县外市内）</option>
                        <option value="zigong">自贡市</option>
                        <option value="mianyang">绵阳市</option>
                        <option value="leshan">乐山市</option>
                        <option value="yaan">雅安市</option>
                        <option value="yibin">宜宾市</option>
                        <option value="liangshan">凉山州</option>
                        <option value="aba">阿坝州</option>
                        <option value="ganzi">甘孜州</option>
                        <option value="deyang">德阳市</option>
                        <option value="suining">遂宁市</option>
                        <option value="bazhong">巴中市</option>
                        <option value="other-sichuan">省内其他城市</option>
                    </select>
                </div>
                
                <div class="form-group">
                    <label for="specific-destination-mobile">具体地点（可选）</label>
                    <input type="text" id="specific-destination-mobile" placeholder="例如：四川大学华西医院">
                </div>
                
                <div class="form-group">
                    <label for="departure-date-mobile">出发时间</label>
                    <div class="date-time-group">
                        <input type="date" id="departure-date-mobile" class="date-input">
                        <select id="departure-time-mobile" class="time-select">
                            <option value="morning">上午</option>
                            <option value="afternoon" selected>下午</option>
                        </select>
                    </div>
                </div>
                
                <div class="form-group">
                    <label for="return-date-mobile">返回时间</label>
                    <div class="date-time-group">
                        <input type="date" id="return-date-mobile" class="date-input">
                        <select id="return-time-mobile" class="time-select">
                            <option value="morning" selected>上午</option>
                            <option value="afternoon">下午</option>
                        </select>
                    </div>
                </div>
                
                <div class="form-group">
                    <label>单位派车情况</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="no-car-mobile" name="car-mobile" value="no-car" checked>
                            <label for="no-car-mobile">未派车（自行乘坐交通工具）</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="city-car-mobile" name="car-mobile" value="city-car">
                            <label for="city-car-mobile">单位派车（仅城市间交通）</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="full-car-mobile" name="car-mobile" value="full-car">
                            <label for="full-car-mobile">单位派车（全程）</label>
                        </div>
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="checkbox-group">
                        <div class="checkbox-option">
                            <input type="checkbox" id="same-day-return-mobile">
                            <label for="same-day-return-mobile">当天往返（下午出差上午归来合并按1天计算）</label>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="section">
                <h2>费用明细</h2>
                
                <div class="form-group">
                    <label for="transport-fee-mobile">城市间交通费（元）</label>
                    <input type="number" id="transport-fee-mobile" min="0" value="0" placeholder="输入交通费金额">
                </div>
                
                <div class="form-group">
                    <label for="accommodation-fee-mobile">住宿费（元）</label>
                    <input type="number" id="accommodation-fee-mobile" min="0" value="0" placeholder="输入住宿费金额">
                </div>
                
                <div class="form-group">
                    <label for="training-days-mobile">培训/会议天数（如适用）</label>
                    <input type="number" id="training-days-mobile" min="0" value="0" placeholder="填写天数">
                </div>
                
                <div class="form-group">
                    <label for="internship-duration-mobile">进修时长（如适用）</label>
                    <select id="internship-duration-mobile">
                        <option value="0">不适用</option>
                        <option value="15">15天以内</option>
                        <option value="30">15-30天</option>
                        <option value="60">1-2个月</option>
                        <option value="90">2-3个月</option>
                        <option value="120">3-4个月</option>
                        <option value="180">4-6个月</option>
                        <option value="365">6个月以上</option>
                    </select>
                </div>
                
                <div class="note">
                    <h4>说明：</h4>
                    <p>1. 伙食补助费和公杂费按标准包干使用，无需填写实际发生额</p>
                    <p>2. 住宿费报销金额不超过标准限额，超支部分个人自理</p>
                    <p>3. 进修超过15天的，伙食补助费和公杂费不予报销</p>
                </div>
            </div>
            
            <div class="button-group">
                <button id="calculate-btn-mobile" class="touch-button">计算报销金额</button>
                <button id="reset-btn-mobile" class="touch-button" style="background-color: #95a5a6;">重置</button>
                <button id="set-today-mobile" class="touch-button" style="background-color: #27ae60;">设为今日出差</button>
            </div>
            
            <div id="days-calculation-mobile" class="result-box" style="display: none;">
                <h3>出差天数计算明细</h3>
                <div id="days-detail-mobile"></div>
            </div>
            
            <div id="result-section-mobile" class="result-box" style="display: none;">
                <h2>报销计算结果</h2>
                <div id="result-content-mobile"></div>
            </div>
        </div>
        
        <!-- 其他选项卡内容（简化为移动版） -->
        <div id="standards" class="tab-content">
            <div class="section">
                <h2>差旅费报销标准</h2>
                
                <h3>一、乘坐交通工具等级标准</h3>
                <div style="overflow-x: auto;">
                    <table class="standard-table">
                        <thead>
                            <tr>
                                <th>人员级别</th>
                                <th>飞机</th>
                                <th>火车</th>
                                <th>其他</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>县处级以上</td>
                                <td>经济舱</td>
                                <td>软席/一等座</td>
                                <td>凭据报销</td>
                            </tr>
                            <tr>
                                <td>科级及以下</td>
                                <td>经济舱</td>
                                <td>硬席/二等座</td>
                                <td>凭据报销</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <h3>二、伙食补助费标准（元/人·天）</h3>
                <div style="overflow-x: auto;">
                    <table class="standard-table">
                        <thead>
                            <tr>
                                <th>地区</th>
                                <th>标准</th>
                                <th>备注</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>省外（一般）</td>
                                <td>100</td>
                                <td>西藏、新疆、青海120</td>
                            </tr>
                            <tr>
                                <td>省内（内地）</td>
                                <td>100</td>
                                <td>三州地区120</td>
                            </tr>
                            <tr>
                                <td>市内（县外）</td>
                                <td>60</td>
                                <td>其他区县</td>
                            </tr>
                            <tr>
                                <td>县内各镇</td>
                                <td>50</td>
                                <td>25元/餐，一天两餐</td>
                            </tr>
                            <tr>
                                <td>县城范围</td>
                                <td>0</td>
                                <td>特殊情况25元/餐</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <div class="note">
                    <h4>文件依据：</h4>
                    <p>泸县财行〔2016〕4号、泸县康院发〔2015〕8号、泸县财行〔2018〕9号</p>
                </div>
            </div>
        </div>
        
        <!-- 其他选项卡内容简化，实际使用时可以添加完整内容 -->
        <div id="accommodation" class="tab-content">
            <div class="section">
                <h2>住宿费标准明细</h2>
                <p>详细住宿费标准请参考PC版工具或相关文件。</p>
                <div class="note">
                    <p>依据：泸县财行〔2016〕5号</p>
                </div>
            </div>
        </div>
        
        <div id="card-explain" class="tab-content">
            <div class="section">
                <h2>公务消费未刷公务卡说明</h2>
                <p>此功能在移动端使用时，建议填写后打印提交。</p>
                <!-- 简化的表单 -->
                <div class="form-group">
                    <label for="card-name-mobile">姓名</label>
                    <input type="text" id="card-name-mobile" placeholder="填写姓名">
                </div>
                <div class="form-group">
                    <label for="card-amount-mobile">金额（元）</label>
                    <input type="number" id="card-amount-mobile" placeholder="填写金额">
                </div>
                <button id="generate-card-explain-mobile" class="touch-button">生成说明</button>
            </div>
        </div>
        
        <div id="integrity-commitment" class="tab-content">
            <div class="section">
                <h2>公务出差廉洁承诺书</h2>
                <p>此功能在移动端使用时，建议填写后打印提交。</p>
                <!-- 简化的表单 -->
                <div class="form-group">
                    <label for="commitment-name-mobile">姓名</label>
                    <input type="text" id="commitment-name-mobile" placeholder="填写姓名">
                </div>
                <div class="form-group">
                    <label for="commitment-purpose-mobile">公务内容</label>
                    <input type="text" id="commitment-purpose-mobile" placeholder="填写公务内容">
                </div>
                <button id="generate-commitment-mobile" class="touch-button">生成承诺书</button>
            </div>
        </div>
        
        <div id="reference" class="tab-content">
            <div class="section">
                <h2>政策依据文件</h2>
                <div class="note">
                    <h4>主要文件：</h4>
                    <ul style="padding-left: 20px;">
                        <li>泸县康院发〔2015〕8号</li>
                        <li>泸县财行〔2016〕4号</li>
                        <li>泸县财行〔2016〕5号</li>
                        <li>泸县财行〔2018〕9号</li>
                        <li>泸县康院发〔2016〕17/18号</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <!-- 打印容器 -->
    <div id="print-container-mobile" class="print-container" style="display: none;"></div>

    <script>
        // 移动端优化JavaScript
        document.addEventListener('DOMContentLoaded', function() {
            // 设置默认日期
            const today = new Date();
            const tomorrow = new Date(today);
            tomorrow.setDate(tomorrow.getDate() + 1);
            
            function formatDate(date) {
                const year = date.getFullYear();
                const month = String(date.getMonth() + 1).padStart(2, '0');
                const day = String(date.getDate()).padStart(2, '0');
                return `${year}-${month}-${day}`;
            }
            
            // 初始化日期
            document.getElementById('departure-date-mobile').value = formatDate(today);
            document.getElementById('return-date-mobile').value = formatDate(tomorrow);
            
            // 选项卡切换
            const tabs = document.querySelectorAll('.tab');
            const tabContents = document.querySelectorAll('.tab-content');
            
            tabs.forEach(tab => {
                tab.addEventListener('click', function() {
                    const tabId = this.getAttribute('data-tab');
                    
                    // 移除所有active类
                    tabs.forEach(t => t.classList.remove('active'));
                    tabContents.forEach(content => content.classList.remove('active'));
                    
                    // 添加active类
                    this.classList.add('active');
                    document.getElementById(tabId).classList.add('active');
                    
                    // 滚动到顶部
                    window.scrollTo(0, 0);
                });
            });
            
            // 根据省份选择切换城市选项
            const provinceSelect = document.getElementById('destination-province-mobile');
            const citySelect = document.getElementById('destination-city-mobile');
            
            provinceSelect.addEventListener('change', function() {
                const province = this.value;
                citySelect.innerHTML = '';
                
                if (province === 'sichuan') {
                    // 四川省内城市
                    const cities = [
                        {value: 'chengdu', text: '成都市'},
                        {value: 'luzhou', text: '泸州市（县外市内）'},
                        {value: 'zigong', text: '自贡市'},
                        {value: 'mianyang', text: '绵阳市'},
                        {value: 'leshan', text: '乐山市'},
                        {value: 'yaan', text: '雅安市'},
                        {value: 'yibin', text: '宜宾市'},
                        {value: 'liangshan', text: '凉山州'},
                        {value: 'aba', text: '阿坝州'},
                        {value: 'ganzi', text: '甘孜州'},
                        {value: 'deyang', text: '德阳市'},
                        {value: 'suining', text: '遂宁市'},
                        {value: 'bazhong', text: '巴中市'},
                        {value: 'other-sichuan', text: '省内其他城市'}
                    ];
                    
                    cities.forEach(city => {
                        const option = document.createElement('option');
                        option.value = city.value;
                        option.textContent = city.text;
                        citySelect.appendChild(option);
                    });
                } else if (province === 'luxian-county') {
                    // 泸县县内各乡镇
                    const towns = [
                        {value: 'yuchan-street', text: '玉蟾街道'},
                        {value: 'fuji-town', text: '福集镇'},
                        {value: 'desheng-town', text: '得胜镇'},
                        {value: 'yusi-town', text: '喻寺镇'},
                        {value: 'fangdong-town', text: '方洞镇'},
                        {value: 'jiaming-town', text: '嘉明镇'},
                        {value: 'tianxing-town', text: '天兴镇'},
                        {value: 'liutan-town', text: '牛滩镇'},
                        {value: 'chaohe-town', text: '潮河镇'},
                        {value: 'haichao-town', text: '海潮镇'},
                        {value: 'yunlong-town', text: '云龙镇'},
                        {value: 'qifeng-town', text: '奇峰镇'},
                        {value: 'xuantan-town', text: '玄滩镇'},
                        {value: 'shiqiao-town', text: '石桥镇'},
                        {value: 'pilu-town', text: '毗卢镇'},
                        {value: 'lishi-town', text: '立石镇'},
                        {value: 'yunjin-town', text: '云锦镇'},
                        {value: 'baihe-town', text: '百和镇'},
                        {value: 'zhaoya-town', text: '兆雅镇'},
                        {value: 'taifu-town', text: '太伏镇'}
                    ];
                    
                    towns.forEach(town => {
                        const option = document.createElement('option');
                        option.value = town.value;
                        option.textContent = town.text;
                        citySelect.appendChild(option);
                    });
                } else {
                    // 省外城市
                    const cities = [
                        {value: 'beijing', text: '北京市'},
                        {value: 'shanghai', text: '上海市'},
                        {value: 'guangzhou', text: '广州市'},
                        {value: 'shenzhen', text: '深圳市'},
                        {value: 'chongqing', text: '重庆市'},
                        {value: 'other-capital', text: '其他省会城市'},
                        {value: 'non-capital', text: '非省会城市'}
                    ];
                    
                    cities.forEach(city => {
                        const option = document.createElement('option');
                        option.value = city.value;
                        option.textContent = city.text;
                        citySelect.appendChild(option);
                    });
                }
            });
            
            // 当天往返复选框逻辑
            const sameDayReturnCheckbox = document.getElementById('same-day-return-mobile');
            sameDayReturnCheckbox.addEventListener('change', function() {
                if (this.checked) {
                    const departureDate = document.getElementById('departure-date-mobile').value;
                    document.getElementById('return-date-mobile').value = departureDate;
                    document.getElementById('departure-time-mobile').value = 'afternoon';
                    document.getElementById('return-time-mobile').value = 'morning';
                }
            });
            
            // 设为今日出差按钮
            document.getElementById('set-today-mobile').addEventListener('click', function() {
                document.getElementById('departure-date-mobile').value = formatDate(today);
                document.getElementById('return-date-mobile').value = formatDate(today);
                document.getElementById('departure-time-mobile').value = 'morning';
                document.getElementById('return-time-mobile').value = 'afternoon';
                sameDayReturnCheckbox.checked = true;
            });
            
            // 计算按钮事件
            document.getElementById('calculate-btn-mobile').addEventListener('click', function() {
                calculateReimbursementMobile();
            });
            
            // 重置按钮事件
            document.getElementById('reset-btn-mobile').addEventListener('click', function() {
                document.getElementById('departure-location-mobile').value = '泸县康复医院';
                document.getElementById('specific-destination-mobile').value = '';
                document.getElementById('departure-date-mobile').value = formatDate(today);
                document.getElementById('return-date-mobile').value = formatDate(tomorrow);
                document.getElementById('departure-time-mobile').value = 'afternoon';
                document.getElementById('return-time-mobile').value = 'morning';
                document.getElementById('transport-fee-mobile').value = 0;
                document.getElementById('accommodation-fee-mobile').value = 0;
                document.getElementById('training-days-mobile').value = 0;
                document.getElementById('internship-duration-mobile').value = '0';
                document.getElementById('same-day-return-mobile').checked = false;
                document.getElementById('no-car-mobile').checked = true;
                document.getElementById('result-section-mobile').style.display = 'none';
                document.getElementById('days-calculation-mobile').style.display = 'none';
            });
            
            // 住宿费标准数据
            const accommodationStandardsMobile = {
                'chengdu': {department: 470, county: 430, other: 370},
                'luzhou': {department: 430, county: 380, other: 300},
                'zigong': {department: 430, county: 380, other: 300},
                'mianyang': {department: 430, county: 400, other: 320},
                'leshan': {department: 430, county: 400, other: 320},
                'yaan': {department: 430, county: 400, other: 320},
                'yibin': {department: 430, county: 380, other: 300},
                'liangshan': {department: 430, county: 410, other: 330},
                'aba': {department: 430, county: 410, other: 330},
                'ganzi': {department: 430, county: 410, other: 330},
                'deyang': {department: 430, county: 390, other: 310},
                'suining': {department: 430, county: 390, other: 310},
                'bazhong': {department: 430, county: 390, other: 310},
                'other-sichuan': {department: 430, county: 380, other: 300},
                
                // 泸县县内各乡镇
                'yuchan-street': {department: 100, county: 100, other: 100},
                'fuji-town': {department: 100, county: 100, other: 100},
                'desheng-town': {department: 100, county: 100, other: 100},
                'yusi-town': {department: 100, county: 100, other: 100},
                'fangdong-town': {department: 100, county: 100, other: 100},
                'jiaming-town': {department: 100, county: 100, other: 100},
                'tianxing-town': {department: 100, county: 100, other: 100},
                'liutan-town': {department: 100, county: 100, other: 100},
                'chaohe-town': {department: 100, county: 100, other: 100},
                'haichao-town': {department: 100, county: 100, other: 100},
                'yunlong-town': {department: 100, county: 100, other: 100},
                'qifeng-town': {department: 100, county: 100, other: 100},
                'xuantan-town': {department: 100, county: 100, other: 100},
                'shiqiao-town': {department: 100, county: 100, other: 100},
                'pilu-town': {department: 100, county: 100, other: 100},
                'lishi-town': {department: 100, county: 100, other: 100},
                'yunjin-town': {department: 100, county: 100, other: 100},
                'baihe-town': {department: 100, county: 100, other: 100},
                'zhaoya-town': {department: 100, county: 100, other: 100},
                'taifu-town': {department: 100, county: 100, other: 100},
                
                // 省外城市
                'beijing': {department: 650, county: 600, other: 500},
                'shanghai': {department: 600, county: 570, other: 500},
                'guangzhou': {department: 550, county: 520, other: 450},
                'shenzhen': {department: 550, county: 520, other: 450},
                'chongqing': {department: 480, county: 440, other: 370},
                'other-capital': {department: 500, county: 460, other: 380},
                'non-capital': {department: 450, county: 400, other: 350}
            };
            
            // 伙食补助费标准
            const mealAllowanceStandardsMobile = {
                'sichuan': {
                    'chengdu': 100,
                    'luzhou': 60,
                    'zigong': 100,
                    'mianyang': 100,
                    'leshan': 100,
                    'yaan': 100,
                    'yibin': 100,
                    'liangshan': 120,
                    'aba': 120,
                    'ganzi': 120,
                    'deyang': 100,
                    'suining': 100,
                    'bazhong': 100,
                    'other-sichuan': 100
                },
                'luxian-county': {
                    'yuchan-street': 0,
                    'fuji-town': 0,
                    'desheng-town': 0,
                    'yusi-town': 50,
                    'fangdong-town': 50,
                    'jiaming-town': 50,
                    'tianxing-town': 50,
                    'liutan-town': 50,
                    'chaohe-town': 50,
                    'haichao-town': 50,
                    'yunlong-town': 50,
                    'qifeng-town': 50,
                    'xuantan-town': 50,
                    'shiqiao-town': 50,
                    'pilu-town': 50,
                    'lishi-town': 50,
                    'yunjin-town': 50,
                    'baihe-town': 50,
                    'zhaoya-town': 50,
                    'taifu-town': 50
                },
                'other-province': {
                    'beijing': 100,
                    'shanghai': 100,
                    'guangzhou': 100,
                    'shenzhen': 100,
                    'chongqing': 100,
                    'other-capital': 100,
                    'non-capital': 100
                }
            };
            
            // 公杂费标准
            const miscAllowanceStandardsMobile = {
                'sichuan': {
                    'chengdu': 50,
                    'luzhou': 40,
                    'zigong': 50,
                    'mianyang': 50,
                    'leshan': 50,
                    'yaan': 50,
                    'yibin': 50,
                    'liangshan': 50,
                    'aba': 50,
                    'ganzi': 50,
                    'deyang': 50,
                    'suining': 50,
                    'bazhong': 50,
                    'other-sichuan': 50
                },
                'luxian-county': {
                    'yuchan-street': 0,
                    'fuji-town': 0,
                    'desheng-town': 0,
                    'yusi-town': 20,
                    'fangdong-town': 20,
                    'jiaming-town': 20,
                    'tianxing-town': 20,
                    'liutan-town': 20,
                    'chaohe-town': 20,
                    'haichao-town': 20,
                    'yunlong-town': 20,
                    'qifeng-town': 20,
                    'xuantan-town': 20,
                    'shiqiao-town': 20,
                    'pilu-town': 20,
                    'lishi-town': 20,
                    'yunjin-town': 20,
                    'baihe-town': 20,
                    'zhaoya-town': 20,
                    'taifu-town': 20
                },
                'other-province': {
                    'beijing': 80,
                    'shanghai': 80,
                    'guangzhou': 80,
                    'shenzhen': 80,
                    'chongqing': 80,
                    'other-capital': 80,
                    'non-capital': 80
                }
            };
            
            // 计算出差天数
            function calculateTravelDaysMobile() {
                const departureDate = new Date(document.getElementById('departure-date-mobile').value);
                const returnDate = new Date(document.getElementById('return-date-mobile').value);
                const departureTime = document.getElementById('departure-time-mobile').value;
                const returnTime = document.getElementById('return-time-mobile').value;
                
                // 计算日期差
                const timeDiff = returnDate.getTime() - departureDate.getTime();
                const dayDiff = Math.floor(timeDiff / (1000 * 3600 * 24));
                
                // 基础天数
                let travelDays = dayDiff + 1;
                
                // 根据规定调整
                if (departureTime === 'afternoon') {
                    travelDays -= 0.5;
                }
                
                if (returnTime === 'morning') {
                    travelDays -= 0.5;
                }
                
                // 确保至少为1天
                if (travelDays < 1) {
                    travelDays = 1;
                }
                
                // 如果当天往返，按1天计算
                if (dayDiff === 0) {
                    travelDays = 1;
                }
                
                return {
                    totalDays: travelDays,
                    dayDiff: dayDiff,
                    departureTime: departureTime,
                    returnTime: returnTime
                };
            }
            
            // 计算报销
            function calculateReimbursementMobile() {
                // 获取表单值
                const personnelLevel = document.getElementById('personnel-level-mobile').value;
                const travelType = document.getElementById('travel-type-mobile').value;
                const departureLocation = document.getElementById('departure-location-mobile').value;
                const destinationProvince = document.getElementById('destination-province-mobile').value;
                const destinationCity = document.getElementById('destination-city-mobile').value;
                const specificDestination = document.getElementById('specific-destination-mobile').value;
                const trainingDays = parseInt(document.getElementById('training-days-mobile').value) || 0;
                const internshipDuration = parseInt(document.getElementById('internship-duration-mobile').value) || 0;
                const transportFee = parseFloat(document.getElementById('transport-fee-mobile').value) || 0;
                const accommodationFee = parseFloat(document.getElementById('accommodation-fee-mobile').value) || 0;
                
                // 获取派车情况
                let carType = 'no-car';
                if (document.getElementById('city-car-mobile').checked) carType = 'city-car';
                if (document.getElementById('full-car-mobile').checked) carType = 'full-car';
                
                // 计算出差天数
                const daysInfo = calculateTravelDaysMobile();
                const travelDays = daysInfo.totalDays;
                
                // 检查培训天数
                const effectiveTrainingDays = Math.min(trainingDays, travelDays);
                
                // 检查进修天数
                const internshipDays = travelType === 'internship' ? internshipDuration : 0;
                
                // 初始化结果
                let results = {
                    transport: 0,
                    accommodation: 0,
                    mealAllowance: 0,
                    miscAllowance: 0,
                    total: 0,
                    accommodationStandard: 0,
                    accommodationDetail: ''
                };
                
                // 1. 交通费
                if (carType === 'full-car') {
                    results.transport = 0;
                } else {
                    results.transport = transportFee;
                }
                
                // 2. 住宿费
                const levelKey = personnelLevel === 'department' ? 'department' : 
                                personnelLevel === 'county' ? 'county' : 'other';
                
                let accommodationStandard = 0;
                let accommodationDetail = '';
                
                // 判断是否为进修且超过15天
                if (travelType === 'internship' && internshipDays > 15) {
                    // 进修超过15天，按定额标准
                    const isCapital = ['chengdu', 'beijing', 'shanghai', 'guangzhou', 'shenzhen', 'chongqing', 'other-capital'].includes(destinationCity);
                    const monthlyStandard = isCapital ? 400 : 300;
                    
                    // 计算月数
                    const months = internshipDays / 30;
                    let calculatedMonths;
                    
                    if (months <= 0.5) {
                        calculatedMonths = 0.5;
                    } else if (months > 0.5 && months <= 1) {
                        calculatedMonths = 1;
                    } else {
                        const fullMonths = Math.floor(months);
                        const remainder = months - fullMonths;
                        
                        if (remainder <= 0.5) {
                            calculatedMonths = fullMonths + 0.5;
                        } else {
                            calculatedMonths = fullMonths + 1;
                        }
                    }
                    
                    accommodationStandard = monthlyStandard * calculatedMonths;
                    accommodationDetail = `进修住宿费定额：${isCapital ? '省会/一线城市' : '其他城市'} ${monthlyStandard}元/月 × ${calculatedMonths}月`;
                    
                    // 县内进修不报销住宿费
                    if (destinationProvince === 'luxian-county') {
                        accommodationDetail += '<br><span style="color:#e74c3c;">注意：县内进修不报销住宿费</span>';
                        accommodationStandard = 0;
                    }
                } else {
                    // 普通出差
                    if (destinationCity in accommodationStandardsMobile) {
                        accommodationStandard = accommodationStandardsMobile[destinationCity][levelKey] * travelDays;
                        let locationName = destinationCity;
                        if (destinationProvince === 'luxian-county') {
                            locationName = '泸县' + getTownNameMobile(destinationCity);
                        }
                        accommodationDetail = `${locationName}住宿费标准：${accommodationStandardsMobile[destinationCity][levelKey]}元/天 × ${travelDays.toFixed(1)}天`;
                    } else {
                        // 默认值
                        if (destinationProvince === 'luxian-county') {
                            accommodationStandard = 100 * travelDays;
                            accommodationDetail = `泸县县内住宿费标准：100元/天 × ${travelDays.toFixed(1)}天`;
                        } else {
                            accommodationStandard = destinationProvince === 'sichuan' ? 300 * travelDays : 350 * travelDays;
                            accommodationDetail = `默认住宿费标准：${destinationProvince === 'sichuan' ? 300 : 350}元/天 × ${travelDays.toFixed(1)}天`;
                        }
                    }
                }
                
                results.accommodationStandard = accommodationStandard;
                results.accommodationDetail = accommodationDetail;
                results.accommodation = Math.min(accommodationFee, accommodationStandard);
                
                // 3. 伙食补助费
                let mealAllowancePerDay = 0;
                if (destinationProvince === 'sichuan') {
                    mealAllowancePerDay = mealAllowanceStandardsMobile.sichuan[destinationCity] || 100;
                } else if (destinationProvince === 'luxian-county') {
                    mealAllowancePerDay = mealAllowanceStandardsMobile['luxian-county'][destinationCity] || 50;
                } else {
                    mealAllowancePerDay = mealAllowanceStandardsMobile['other-province'][destinationCity] || 100;
                }
                
                // 特殊地区调整
                if (destinationCity === 'luzhou') mealAllowancePerDay = 60;
                
                // 进修超过15天的不报销伙食补助
                if (travelType === 'internship' && internshipDays > 15) {
                    mealAllowancePerDay = 0;
                }
                
                // 会议/培训期间，举办单位安排食宿的不报销伙食补助
                let effectiveTravelDays = travelDays;
                if ((travelType === 'conference' || travelType === 'training') && effectiveTrainingDays > 0) {
                    effectiveTravelDays = travelDays - effectiveTrainingDays;
                }
                
                results.mealAllowance = mealAllowancePerDay * effectiveTravelDays;
                
                // 4. 公杂费
                let miscAllowancePerDay = 0;
                if (destinationProvince === 'sichuan') {
                    miscAllowancePerDay = miscAllowanceStandardsMobile.sichuan[destinationCity] || 50;
                } else if (destinationProvince === 'luxian-county') {
                    miscAllowancePerDay = miscAllowanceStandardsMobile['luxian-county'][destinationCity] || 20;
                } else {
                    miscAllowancePerDay = miscAllowanceStandardsMobile['other-province'][destinationCity] || 80;
                }
                
                // 特殊地区调整
                if (destinationCity === 'luzhou') miscAllowancePerDay = 40;
                
                // 派车情况影响公杂费
                if (carType === 'full-car') {
                    miscAllowancePerDay = miscAllowancePerDay * 0.5;
                }
                
                // 进修超过15天的不报销公杂费
                if (travelType === 'internship' && internshipDays > 15) {
                    miscAllowancePerDay = 0;
                }
                
                // 会议/培训期间公杂费减半
                let conferenceTrainingDays = 0;
                if (travelType === 'conference' || travelType === 'training') {
                    conferenceTrainingDays = effectiveTrainingDays;
                }
                
                // 计算公杂费
                const normalDays = effectiveTravelDays;
                const conferenceDays = conferenceTrainingDays;
                
                results.miscAllowance = (miscAllowancePerDay * normalDays) + 
                                       (miscAllowancePerDay * 0.5 * conferenceDays);
                
                // 5. 计算总额
                results.total = results.transport + results.accommodation + 
                               results.mealAllowance + results.miscAllowance;
                
                // 显示结果
                displayResultsMobile(results, daysInfo, travelDays, effectiveTravelDays, conferenceTrainingDays,
                                    departureLocation, specificDestination, carType, destinationCity, destinationProvince);
            }
            
            // 获取乡镇名称
            function getTownNameMobile(townCode) {
                const townNames = {
                    'yuchan-street': '玉蟾街道',
                    'fuji-town': '福集镇',
                    'desheng-town': '得胜镇',
                    'yusi-town': '喻寺镇',
                    'fangdong-town': '方洞镇',
                    'jiaming-town': '嘉明镇',
                    'tianxing-town': '天兴镇',
                    'liutan-town': '牛滩镇',
                    'chaohe-town': '潮河镇',
                    'haichao-town': '海潮镇',
                    'yunlong-town': '云龙镇',
                    'qifeng-town': '奇峰镇',
                    'xuantan-town': '玄滩镇',
                    'shiqiao-town': '石桥镇',
                    'pilu-town': '毗卢镇',
                    'lishi-town': '立石镇',
                    'yunjin-town': '云锦镇',
                    'baihe-town': '百和镇',
                    'zhaoya-town': '兆雅镇',
                    'taifu-town': '太伏镇'
                };
                return townNames[townCode] || townCode;
            }
            
            // 显示结果
            function displayResultsMobile(results, daysInfo, travelDays, effectiveTravelDays, conferenceTrainingDays,
                                         departureLocation, specificDestination, carType, destinationCity, destinationProvince) {
                const resultSection = document.getElementById('result-section-mobile');
                const resultContent = document.getElementById('result-content-mobile');
                const daysCalculation = document.getElementById('days-calculation-mobile');
                const daysDetail = document.getElementById('days-detail-mobile');
                
                // 格式化时间显示
                const departureDate = document.getElementById('departure-date-mobile').value;
                const returnDate = document.getElementById('return-date-mobile').value;
                const departureTime = document.getElementById('departure-time-mobile').value === 'morning' ? '上午' : '下午';
                const returnTime = document.getElementById('return-time-mobile').value === 'morning' ? '上午' : '下午';
                
                // 获取目的地显示名称
                let destinationDisplay = destinationCity;
                if (destinationProvince === 'luxian-county') {
                    destinationDisplay = '泸县' + getTownNameMobile(destinationCity);
                } else if (destinationCity === 'luzhou') {
                    destinationDisplay = '泸州市（县外市内）';
                }
                
                // 显示天数计算明细
                daysDetail.innerHTML = `
                    <div class="result-item">
                        <span>出发时间</span>
                        <span>${departureDate} ${departureTime}</span>
                    </div>
                    <div class="result-item">
                        <span>返回时间</span>
                        <span>${returnDate} ${returnTime}</span>
                    </div>
                    <div class="result-item">
                        <span>日历天数</span>
                        <span>${daysInfo.dayDiff + 1} 天</span>
                    </div>
                    <div class="result-item">
                        <span>时间调整</span>
                        <span>${departureTime === '下午' ? '-0.5天' : ''} ${returnTime === '上午' ? '-0.5天' : ''}</span>
                    </div>
                    <div class="result-item total">
                        <span>出差总天数</span>
                        <span style="color:#e74c3c; font-weight:bold;">${travelDays.toFixed(1)} 天</span>
                    </div>
                `;
                
                // 显示报销结果
                let transportNote = '';
                if (carType === 'full-car') {
                    transportNote = '<span style="color:#e74c3c; font-size:12px;">（单位派车全程）</span>';
                } else if (carType === 'city-car') {
                    transportNote = '<span style="color:#e67e22; font-size:12px;">（单位派车城市间交通）</span>';
                }
                
                let html = `
                    <div class="result-item">
                        <span>出差路线</span>
                        <span>${departureLocation} → ${specificDestination || destinationDisplay}</span>
                    </div>
                    <div class="result-item">
                        <span>城市间交通费 ${transportNote}</span>
                        <span>${results.transport.toFixed(2)} 元</span>
                    </div>
                    <div class="result-item">
                        <span>住宿费</span>
                        <span>${results.accommodation.toFixed(2)} 元</span>
                    </div>
                    <div class="result-item">
                        <span>伙食补助费</span>
                        <span>${results.mealAllowance.toFixed(2)} 元</span>
                    </div>
                    <div class="result-item">
                        <span>公杂费</span>
                        <span>${results.miscAllowance.toFixed(2)} 元</span>
                    </div>
                    <div class="result-item total">
                        <span>可报销总额</span>
                        <span style="color:#2ecc71; font-size:20px;">${results.total.toFixed(2)} 元</span>
                    </div>
                `;
                
                // 添加住宿费标准说明
                if (results.accommodationDetail) {
                    html += `
                        <div style="background-color:#f8f9fa; padding:10px; margin-top:10px; border-radius:5px; font-size:13px;">
                            ${results.accommodationDetail}
                        </div>
                    `;
                }
                
                // 特别提醒
                const travelType = document.getElementById('travel-type-mobile').value;
                if (travelType === 'internship') {
                    const internshipDuration = parseInt(document.getElementById('internship-duration-mobile').value) || 0;
                    if (internshipDuration > 15) {
                        html += `
                            <div style="background-color:#fffde7; padding:12px; margin-top:15px; border-left:4px solid #f39c12;">
                                <strong>进修特别提醒：</strong> 进修超过15天的，按定额报销住宿费，不报销伙食补助费和公杂费。
                            </div>
                        `;
                    }
                }
                
                // 县内出差特别提醒
                if (destinationProvince === 'luxian-county') {
                    let mealNote = '';
                    if (destinationCity === 'yuchan-street' || destinationCity === 'fuji-town' || destinationCity === 'desheng-town') {
                        mealNote = '<strong>注意：</strong>玉蟾街道、福集镇、得胜镇属于县城范围，原则上不得报销伙食补助。';
                    } else {
                        mealNote = '<strong>注意：</strong>县内其他乡镇伙食补助费50元/天。';
                    }
                    
                    html += `
                        <div style="background-color:#e8f6f3; padding:12px; margin-top:15px; border-left:4px solid #1abc9c;">
                            <strong>县内出差特别提醒：</strong><br>
                            ${mealNote}
                        </div>
                    `;
                }
                
                resultContent.innerHTML = html;
                resultSection.style.display = 'block';
                daysCalculation.style.display = 'block';
                
                // 滚动到结果区域
                resultSection.scrollIntoView({behavior: 'smooth', block: 'start'});
            }
            
            // 为输入框添加触摸优化
            const inputs = document.querySelectorAll('input, select, textarea');
            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    // 确保输入框在视口中可见
                    setTimeout(() => {
                        this.scrollIntoView({behavior: 'smooth', block: 'center'});
                    }, 300);
                });
            });
            
            // 防止表单提交（如果页面被嵌套在表单中）
            document.querySelectorAll('button').forEach(button => {
                button.addEventListener('click', function(e) {
                    if (this.type === 'button') {
                        e.preventDefault();
                    }
                });
            });
            
            // 移动端优化：点击外部关闭键盘
            document.addEventListener('touchstart', function(e) {
                if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
                    document.activeElement.blur();
                }
            });
            
            // 初始化
            console.log("泸县康复医院报销计算器手机版已加载");
        });
    </script>
</body>
</html>